//
//  EMCrypt.h
//  EasyMoney
//
//  Created by 邓乐 on 2020/1/9.
//  Copyright © 2020 zh. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface EMCrypt : NSObject

/**
 *  加密算法
 *
 *  @param message  明文
 *  @param password 密钥
 *
 *  @return 密文
 */
+ (NSString *)encrypt:(NSString *)message password:(NSString *)password;

/**
 *  解密算法
 *
 *  @param base64EncodedString 密文
 *  @param password            明文
 *
 *  @return <#return value description#>
 */
+ (NSString *)decrypt:(NSString *)base64EncodedString password:(NSString *)password;



+(NSString*)encryptByRootKeyWithMessage:(NSString*)message salt:(NSString*)salt;

+(NSString*)decryptByRootKeyWithMessage:(NSString*)message salt:(NSString*)salt;

//*******************************************RSA 加密／解密********************************************************//

/**
 *  RSA 加密
 *
 *  @param message   <#message description#>
 *  @param publicKey 公钥
 *
 *  @return <#return value description#>
 */
+ (NSString *)encryptUseRSA:(NSString *)message PublicKey:(NSString *)publicKey;

/**
 *  RSA 公钥解密
 *
 *  @param base64EncodedString <#base64EncodedString description#>
 *  @param publicKey           公钥
 *
 *  @return <#return value description#>
 */
+ (NSString *)decryptUseRSA:(NSString *)base64EncodedString PublicKey:(NSString *)publicKey;

/**
 *  RSA 私钥解密
 *
 *  @param base64EncodedString <#base64EncodedString description#>
 *  @param privateKey          私钥
 *
 *  @return <#return value description#>
 */
+ (NSString *)decryptUseRSA:(NSString *)base64EncodedString PrivateKey:(NSString *)privateKey;

/**
 *  通过.der文件的方式公钥加密
 *
 *  @param message       <#message description#>
 *  @param publicKeyPath <#publicKeyPath description#>
 *
 *  @return <#return value description#>
 */
+ (NSString *)encryptUseRSA:(NSString *)message PublicKeyPath:(NSString *)publicKeyPath;

/**
 *  通过p12文件私钥解密
 *
 *  @param base64EncodedString <#base64EncodedString description#>
 *  @param privateKeyPath      <#privateKeyPath description#>
 *  @param password            <#password description#>
 *
 *  @return <#return value description#>
 */
+ (NSString *)decryptUseRSA:(NSString *)base64EncodedString PrivateKeyPath:(NSString *)privateKeyPath Password:(NSString*)password;

//**********************************************DES 加密／解密************************************************//
//加密方法
+(NSString *) encryptUseDES:(NSString *)message key:(NSString *)key;
+(NSString *) encryptUseDESData:(NSData *)data key:(NSString *)key;
//解密方法
+(NSString *)decryptUseDES:(NSString *)base64EncodedString key:(NSString *)key;

@end

NS_ASSUME_NONNULL_END
